<template>
  <div>
    <p>使用方式二</p>
    <h3>最新的count值：{{ count }}</h3>
    <h3>{{showNum}}</h3>
    <button @click="add(-1)">-1</button>
    <button @click="addAsync(-10)">-10</button>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
export default {
  data() {
    return {}
  },
  computed: {
    ...mapState(['count']),
    ...mapGetters(['showNum'])
  },
  methods: {
    ...mapMutations(['add']),
    ...mapActions(['addAsync'])
  }
}
</script>

<style lang="less" scoped></style>
